home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / tic / updatehosts < prev   
Text File  |  1996-10-25  |  2KB  |  74 lines

  1. #!/bin/sh
  2. # @(#) updatehosts 1.9 92/08/31 @(#)
  3. #
  4. # update the host tables and DNS files
  5. #
  6. # arguments are the files to edit
  7. #
  8. # Copyright (c) 1992 by Texas Internet Consulting
  9. # This code may be freely copied and used so long as this
  10. # copyright notice is attached.  This code may not be sold
  11. # without the express written permission of Texas Internet Consulting.
  12. # Texas Internet Consulting makes no warranty as to the correctness
  13. # nor the applicability of this code for any purpose.
  14.  
  15. EDITOR=${EDITOR-vi}
  16. DNS_PARAMETERS=${DNS_PARAMETERS-dns_parameters}
  17. NAMED_DIR=${NAMED_DIR-/etc/named}
  18. cd ${NAMED_DIR}
  19.  
  20. # if no arguments display options
  21. if [ $# -eq 0 ]; then
  22.     echo "Usage: -u | file..."
  23.     exit 1
  24. fi
  25.  
  26. # shift off the update option and proceed
  27. if [ "$1" = "-u" ]; then
  28.     shift
  29. fi
  30.  
  31. # set umask to group read and write
  32. umask 2
  33. # check if the files exist and are under SCCS control and are readable
  34. okay=1
  35. for i do
  36.     if [ ! -f SCCS/s.$i ]; then
  37.         echo "file $i is not under SCCS control"
  38.         okay=0
  39.     elif [ ! -r SCCS/s.$i ]; then
  40.         echo "file $i is not readable by you"
  41.         okay=0
  42.     elif [ -f SCCS/p.$i ]; then
  43.         echo "file $i is already checked out under SCCS"
  44.         okay=0
  45.     elif [ -f $i ]; then
  46.         rm -f $i
  47.     fi
  48. done
  49. if [ $okay -eq 0 ]; then
  50.     exit 1
  51. fi
  52.  
  53. # checkout and edit the files
  54. for i do
  55.     sccs edit $i
  56.     $EDITOR $i
  57.     sccs delget $i
  58. done
  59.  
  60. # update the serial file
  61. sccs edit serial >/dev/null 2>&1
  62. sccs delget -s -y "" serial
  63.  
  64. # generate the static tables
  65. echo "generating static hosts table..."
  66. genstatic
  67.  
  68. # generate the dns map
  69. echo "generating the DNS database..."
  70. gendns
  71. poke_ns reload
  72.  
  73.  
  74.